// pages/my/notices.js
var util = require('../../utils/util');

Page({
  data: {

    notices: []

  },
  onLoad: function (options) {
    // 页面初始化 options为页面跳转所带来的参数
    var notices = wx.getStorageSync('notices');

    for (let i = 0; i < notices.length; i++) {
      var obj = notices[i];
      obj.time = util.formatTime(new Date(obj.createdAt));
    }

    this.data.notices = notices;

  },
  onReady: function () {
    // 页面渲染完成
  },
  onShow: function () {
    // 页面显示
    this.setData({
      notices: this.data.notices
    });
  },
  onHide: function () {
    // 页面隐藏
  },
  onUnload: function () {
    // 页面关闭
  }
})